﻿Imports System.Data
Partial Class WebForm_AssetMaintain_Component_AssetDetail
    Inherits BaseUserControl
    Public Sub InitDataAndShow(ByVal asset_serialNo As String)
        GetData(asset_serialNo)
        Me.mpSearch.Show()
    End Sub
    Public Sub GetData(ByVal asset_serialNo As String)
        lblasset_serialNo1.Text = asset_serialNo
        ddlasset_status.DataBind()

        Dim bbl As AssetManage.BBL.AssetBBL = New AssetManage.BBL.AssetBBL()
        Dim dt As DataTable = bbl.GetAssetData("", "", asset_serialNo, "", "", "", "", "", "", hiDBName.Value)
        Dim dr As DataRow = dt.Rows(0)
        Try
            ddlassetdef_id.SelectedValue = dr("assetdef_id").ToString().Trim
        Catch ex As Exception

        End Try

        txtasset_owner.Text = dr("asset_owner").ToString().Trim
        lblownerName.Text = dr("ownerName").ToString.Trim
        txtEXT.Text = dr("EXT").ToString().Trim
        Try
            ddlasset_status.SelectedValue = dr("asset_status").ToString.Trim
        Catch ex As Exception

        End Try

        txtDept.Text = dr("Dept").ToString().Trim
        txtMAC1.Text = dr("MAC1").ToString().Trim
        txtMAC2.Text = dr("MAC2").ToString().Trim
        Try
            ddlFactory.SelectedValue = dr("Factory").ToString().Trim
        Catch ex As Exception

        End Try

        txtClass.Text = dr("Class").ToString().Trim
        txtLocation.Text = dr("Location").ToString().Trim
        txtAsset_Cost.Text = dr("Asset_Cost").ToString.Trim
        Try
            ddlHouseID.SelectedValue = dr("HouseID").ToString().Trim
        Catch ex As Exception

        End Try

        txtComputerName.Text = dr("ComputerName").ToString.Trim
        txtModel.Text = dr("Model").ToString.Trim
        txtCPU.Text = dr("CPU").ToString.Trim
        txtCD_R.Text = dr("CD_R").ToString.Trim
        txtCD_RW.Text = dr("CD_RW").ToString.Trim
        txtRAM.Text = dr("RAM").ToString.Trim
        Try
            ddlUsingType.SelectedValue = dr("UsingType").ToString.Trim
        Catch ex As Exception

        End Try

        txtOS.Text = dr("OS").ToString.Trim
        txtHDD.Text = dr("HDD").ToString.Trim
        txtMonitorSize.Text = dr("MonitorSize").ToString.Trim
        txtRemark.Text = dr("Remark").ToString.Trim
        txtOtherRemark.Text = dr("OtherRemark").ToString.Trim
        lblCrtName.Text = dr("CrtName").ToString.Trim
        Try
            lblCrtDate1.Text = DateTime.Parse(dr("CrtDate").ToString).ToString("yyyy/MM/dd HH:mm:ss")
        Catch ex As Exception
            lblCrtDate1.Text = ""
        End Try
        lblModiName.Text = dr("ModiName").ToString.Trim
        Try
            lblModiDate1.Text = DateTime.Parse(dr("ModiDate").ToString).ToString("yyyy/MM/dd HH:mm:ss")
        Catch ex As Exception
            lblModiDate1.Text = ""
        End Try
        txtStoreLocation.Text = dr("StoreLocation").ToString.Trim
        txtUser1.Text = dr("User1").ToString.Trim
        Try
            ddlUsingType2.SelectedValue = dr("UsingType2").ToString.Trim
        Catch ex As Exception

        End Try

        txtPS.Text = dr("PS").ToString.Trim
        Try
            ddlStoreHouse.SelectedValue = dr("StoreHouse").ToString.Trim
        Catch ex As Exception

        End Try

        txtNBLabel.Text = dr("NBLabel").ToString.Trim()
        txtFDD.Text = dr("FDD").ToString.Trim
        txtUsingDesc.Text = dr("UsingDesc").ToString.Trim
        '訂顏色
        lblassetdef_id.ForeColor = Drawing.Color.Black
        lblasset_owner.ForeColor = Drawing.Color.Black
        lblownerName.ForeColor = Drawing.Color.Black
        lblEXT.ForeColor = Drawing.Color.Black
        lblasset_status.ForeColor = Drawing.Color.Black
        lblDept.ForeColor = Drawing.Color.Black
        lblMAC1.ForeColor = Drawing.Color.Black
        lblMAC2.ForeColor = Drawing.Color.Black
        lblFactory.ForeColor = Drawing.Color.Black
        lblClass.ForeColor = Drawing.Color.Black
        lblLocation.ForeColor = Drawing.Color.Black
        lblAsset_Cost.ForeColor = Drawing.Color.Black
        lblHouseID.ForeColor = Drawing.Color.Black
        lblComputerName.ForeColor = Drawing.Color.Black
        lblModel.ForeColor = Drawing.Color.Black
        lblCPU.ForeColor = Drawing.Color.Black
        lblCD_R.ForeColor = Drawing.Color.Black
        lblCD_RW.ForeColor = Drawing.Color.Black
        lblRAM.ForeColor = Drawing.Color.Black
        lblUsingType.ForeColor = Drawing.Color.Black
        lblOS.ForeColor = Drawing.Color.Black
        lblHDD.ForeColor = Drawing.Color.Black
        lblMonitorSize.ForeColor = Drawing.Color.Black
        lblRemark.ForeColor = Drawing.Color.Black
        lblOtherRemark.ForeColor = Drawing.Color.Black

        lblStoreLocation.ForeColor = Drawing.Color.Black
        lblUser1.ForeColor = Drawing.Color.Black

        lblUsingType2.ForeColor = Drawing.Color.Black
        lblPS.ForeColor = Drawing.Color.Black
        lblStoreHouse.ForeColor = Drawing.Color.Black
        lblNBLABEL.ForeColor = Drawing.Color.Black
        lblFDD.ForeColor = Drawing.Color.Black

        txtAsset_Cost.ForeColor = Drawing.Color.Black
        ddlassetdef_id.ForeColor = Drawing.Color.Black
        txtasset_owner.ForeColor = Drawing.Color.Black
        lblownerName.ForeColor = Drawing.Color.Black
        txtEXT.ForeColor = Drawing.Color.Black
        ddlasset_status.ForeColor = Drawing.Color.Black
        txtDept.ForeColor = Drawing.Color.Black
        txtMAC1.ForeColor = Drawing.Color.Black
        txtMAC2.ForeColor = Drawing.Color.Black
        ddlFactory.ForeColor = Drawing.Color.Black
        txtClass.ForeColor = Drawing.Color.Black
        txtLocation.ForeColor = Drawing.Color.Black

        ddlHouseID.ForeColor = Drawing.Color.Black
        txtComputerName.ForeColor = Drawing.Color.Black
        txtModel.ForeColor = Drawing.Color.Black
        txtCPU.ForeColor = Drawing.Color.Black
        txtCD_R.ForeColor = Drawing.Color.Black
        txtCD_RW.ForeColor = Drawing.Color.Black
        txtRAM.ForeColor = Drawing.Color.Black
        ddlUsingType.ForeColor = Drawing.Color.Black
        txtOS.ForeColor = Drawing.Color.Black
        txtHDD.ForeColor = Drawing.Color.Black
        txtMonitorSize.ForeColor = Drawing.Color.Black
        txtRemark.ForeColor = Drawing.Color.Black
        txtOtherRemark.ForeColor = Drawing.Color.Black

        txtStoreLocation.ForeColor = Drawing.Color.Black
        txtUser1.ForeColor = Drawing.Color.Black

        ddlUsingType2.ForeColor = Drawing.Color.Black
        txtPS.ForeColor = Drawing.Color.Black
        ddlStoreHouse.ForeColor = Drawing.Color.Black
        txtNBLabel.ForeColor = Drawing.Color.Black
        txtFDD.ForeColor = Drawing.Color.Black
        txtUsingDesc.ForeColor = Drawing.Color.Black

        

    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hiDBName.Value = dbName
            hiUID.Value = ActualUID

        End If
    End Sub

    Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click

    End Sub
End Class
